import request from '@/utils/request';

// 通过流程模板id读取表单字符串接口
export function getformjsonbydeploymentid(params) {
    return request('/api/oa/v1/workflow/template/getprocessjsonbydeploymentid', {
        method: 'POST',
        data: params
    });
}

// 获取请假类型
export function gettypelist() {
    return request('/api/work/v1/attendance/leavetype/web/typelist', {
        method: 'POST'
    });
}

// 通过流程模板id读取表单字符串接口
export function getformjsonbytemplateid(templateId) {
    return request(`/api/oa/v1/workflow/myprocess/getformjsonbytemplateid?templateId=${templateId}`, {
        method: 'POST'
    });
}
// 通过流程部署id和表单变量动态读取流程定义字符串接口
export function getmyprocessjsonbydeploymentid(formValueJson, processDeploymentId) {
    return request('/api/oa/v1/workflow/myprocess/getmyprocessjsonbydeploymentid', {
        method: 'POST',
        data: {
            formValueJson,
            processDeploymentId
        }
    });
}

// 保存员工流程申请表单信息
export function savemyprocessapply(params) {
    return request('/api/oa/v1/workflow/myprocess/savemyprocessapply', {
        method: 'POST',
        data: params
    });
}

// 提交员工流程申请表单信息
export function submitmyprocessapply(params) {
    return request('/api/oa/v1/workflow/myprocess/submitmyprocessapply', {
        method: 'POST',
        data: params
    });
}

// 通过表单部署id读取表单字符串接口
export function getformjsonbyformtemplateid(formTemplateId) {
    return request(`/api/oa/v1/workflow/myprocess/getformjsonbyformtemplateid?formTemplateId=${formTemplateId}`, {
        method: 'GET'
    });
}

// 通过申请编号读取表单值formValueJson字符串接口
export function getformvaluejsonbyapplicationno(applicationNo) {
    return request(`/api/oa/v1/workflow/myprocess/getformvaluejsonbyapplicationno?applicationNo=${applicationNo}`, {
        method: 'GET'
    });
}

/**
 * 面试管理-发起面试-输入名称模糊搜索候选人
 * @method get
 */

export async function companysearchCandidate(params) {
    return request('/api/oa/v1/candidate/companysearchCandidate', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取数据销假对应请假数据
 * @url http://172.16.6.103:9005/project/71/interface/api/58690
 */
export async function fetchLeave(params) {
    return request('/api/work/v1/attendance/leaveflow/web/allowEmpLeaveCancel', {
        method: 'POST',
        data: params
    });
}

/**
 * 招聘申请-读取公司岗位列表带岗位名称模糊查询
 * @method get
 */

export async function getPostListByCondition(params) {
    return request('/api/oa/v1/post/getpostlistbycondition', {
        method: 'POST',
        data: params
    });
}

/**
 * 审批详情接口
 * @method get
 */
export async function getApplyDetail(params) {
    return request('/api/workflowweb/processinstance/v1/getInstanceRecordByInstanceId', {
        method: 'GET',
        params
    });
}
